package buildinjava;

import java.io.File;
import java.net.URL;
import java.util.List;
import java.util.Set;

/**
 * A project.
 *
 * @author Gili Tzabari
 */
public interface Project
{
	/**
	 * Returns the project directory relative to which configurations should be built.
	 *
	 * @return the project directory relative to which configurations should be built
	 */
	File getDirectory();

	/**
	 * Returns a list of all configuration names.
	 *
	 * @return a list of all configuration names
	 */
	Set<String> getConfigurations();

	/**
	 * Returns a configuration by its user-friendly name.
	 *
	 * @param name the configuration user-friendly name
	 * @throws IllegalArgumentException if no match was found
	 */
	Configuration getConfigurationByName(String name);

	/**
	 * Returns the project classpath.
	 *
	 * @author Gili Tzabari
	 */
	interface ClassPath
	{
		/**
		 * Returns the classpath used to compile the {@link Project.Builder}.
		 *
		 * @param buildInJava an instance of {@link BuildInJava}
		 * @param projectDirectory the project directory
		 * @return the classpath used to compile the {@link Project.Builder}
		 */
		List<URL> getCompileClasspath(BuildInJava buildInJava, File projectDirectory);

		/**
		 * Returns the classpath used to run the {@link Project.Builder}.
		 *
		 * @param buildInJava an instance of {@link BuildInJava}
		 * @param projectDirectory the project directory
		 * @return the classpath used to run the {@link Project.Builder}
		 */
		List<URL> getRunClasspath(BuildInJava buildInJava, File projectDirectory);
	}

	/**
	 * Creates a new project.
	 * 
	 * @author Gili Tzabari
	 */
	interface Builder
	{
		/**
		 * Creates a new project.
		 *
		 * @param projectDirectory the project directory
		 * @return the project
		 */
		Project create(File projectDirectory);
	}
}
